{extend name="public/base" /}

{block name="title"}<title>{$Think.lang.list}</title>{/block}

{block name="pjax_container"}
<section class="content-header">
    <h1>课程及器械列表</h1>
    <ol class="breadcrumb">
        <li class="active"><i class="fa fa-dashboard"></i> 课程及器械列表</li>
    </ol>
</section>
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <div class="box box-primary">
                <div class="box-header with-border">
                    {include file="public/top_action" /}
                    {include file="public/search" /}
                </div>
                <div class="box-body table-responsive">
                    <table class="table table-bordered table-hover table-sort">
                        <tr>
                            <th width="35"><input type="checkbox" class="minimal checkbox-toggle"></th>
                            <th>ID</th>
                            <th>课程名称</th>
                            <th>器械名称</th>
                            <th>创建时间</th>
                            <th width="204">{$Think.lang.action}</th>
                        </tr>
                        {foreach name="dataList" item="vo"}
                        <tr>
                            <td style="vertical-align:middle"><input type="checkbox" name="id[]" value="{$vo.id}" class="minimal"></td>
                            <td style="vertical-align:middle">{$vo.id}</td>
                            <td style="vertical-align:middle">{$vo.kc_name}</td>
                            <td style="vertical-align:middle">{$vo.qx_name}</td>
                            <td style="vertical-align:middle">{$vo.create_at}</td>
                            <!-- <td style="vertical-align:middle">
                                {:authAction(CONTROLLER_NAME.'/authGroup', 'auth_group', ['id' => $vo.id])}
                                {include file="public/list_action" /}
                            </td> -->
                            <td colspan="" rowspan="" headers="">
                                    <a title="编辑" href="javascript:;" onclick="member_edit('教师编辑','{:url("teacher/teacherEdit",["id"=>$vo["id"]])}','','510')" class="ml-5" style="text-decoration:none">
                                    <i class="Hui-iconfont">编辑</i>
                                    </a>
                                    <a title="删除" href="javascript:;" onclick="member_del(this,'{$vo.id}')" class="ml-5" style="text-decoration:none">
                                    <i class="Hui-iconfont">删除</i>
                                    </a>
                            </td>
                        </tr>
                        {/foreach}
                    </table>
                </div>
                <div class="box-footer clearfix">
                </div>
            </div>
        </div>
    </div>
</section>
<script type="text/javascript">
    /*用户-删除*/
function member_del(obj,id) {
    $.get("{:url('Qx/delete')}", {id: id});
    confirm('确认要删除吗？', function (index) {
        $(obj).parents("tr").remove();
        alert('已删除!', {icon: 1, time: 1000});
    });
}
$(function(){
    /*ajax页面加载icheck，有该控件的页面才需要*/
    $('input[type="checkbox"].minimal, input[type="radio"].minimal').iCheck({
        checkboxClass: 'icheckbox_minimal-blue',
        radioClass: 'iradio_minimal-blue'
    });

    /*ajax页面加载icheck，有该控件的页面才需要*/
    $(".select2").select2({language:"zh-CN"});

    /*全选-反选*/
    $('.checkbox-toggle').on('ifChecked', function(event){
        var _this = $(this);
        var _table = _this.closest('.table');
        _table.find("tr td input[type='checkbox']").iCheck("check");
    });
    $('.checkbox-toggle').on('ifUnchecked', function(event){
        var _this = $(this);
        var _table = _this.closest('.table');
        _table.find("tr td input[type='checkbox']").iCheck("uncheck");
    });

    $('.editable').editable({
        emptytext: "empty",
        params: function(params) {      //参数
            var data = {};
            data['id'] = params.pk;
            data[params.name] = params.value;
            return data;
        },
        success: function(response, newValue) {
            var res = $.parseJSON( response );
            if(res.status == 1){
            }else{
                return res.info;
            }
        }
    });



    {if condition=" $rest_login == 1 "}
    restlogin('{$rest_login_info}');   //登录超时
    {/if}
})
</script>
{/block}